//
//  MainBizQutoeCellText.m
//  ZITHER
//
//  Created by weixin on 2018/9/4.
//  Copyright © 2018年 weixn. All rights reserved.
//

#import "MainBizQutoeCellText.h"
#import "SKUDetailReceiveVC.h"
@implementation MainBizQutoeCellText

- (void)awakeFromNib {
    [super awakeFromNib];
    
//    self.backgroundColor = [UIColor randomColor];
//    UILabel *lab = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
//    lab.text = @"1231212312311231231123123112312311231231123123112312313112312123123112312311231231123123112312311231231123123131";
//    lab.numberOfLines = 0;
//    [self addSubview:lab];
//    [lab mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.left.right.bottom.mas_equalTo(self).offset(0);
//    }];
    
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setUI];
        [self setMasonry];
    }
    return self;
}

-(void)setIndex:(NSInteger)index{
    _index = index;
//    RootUrlImage
}

-(void)upMassonry:(NSUInteger)index{
    
    // 0:只有手表  1:只有商家  2.有角标 有商家 3.有角标 没商家  4.有结束(角标和商家都没有)
    NSLog(@"index ==== %ld",index);
    
    if (index == 0) {
     
        
    }else{
        
//        [self.viewBizinfo mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.top.equalTo(self).offset(24);
//            make.left.equalTo(self).offset(18);
//            make.right.equalTo(self).offset(-18);
//            make.height.mas_equalTo(60);
//            make.bottom.equalTo(self).offset(-24).priority(10);
//        }];
//
//        [self.viewTips mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.top.equalTo(self.viewReceive.mas_bottom).offset(0);
//            make.left.equalTo(self).offset(18);
//            make.right.equalTo(self).offset(-18);
//            make.height.mas_equalTo(100);
//            //        make.bottom.equalTo(self).offset(-24);
//        }];
//
//        [self.labEnd mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.top.equalTo(self.viewTips.mas_bottom).offset(10);
//            make.left.equalTo(self.viewTips.mas_left).offset(0);
//            make.height.mas_equalTo(22);
//            make.bottom.equalTo(self).offset(-24);
//        }];
//
//        self.viewBizinfo.hidden = NO;
//        self.viewTips.hidden = NO;
//        self.labEnd.hidden = NO;
    }
    

    if (index == 5){
    
    }
    if (index == 6){
        
    }
    if (index == 7){
        
    }
}

//正在询价中
-(void)setModeTyep1:(MyEnquiryListDataNewModel *)modeTyep1{
    _modeTyep1 = modeTyep1;
    // 0:只有手表  1:只有商家  2.有角标 有商家 3.有角标 没商家  4.有结束(角标和商家都没有)
    
    bool bizV = NO;
    bool Tips = NO;
    bool labNewReceiveType = NO;
    bool labNewGoodsSources = NO;
    bool labNewRefresh = NO;
    
    
    
    NSInteger index = 0 ;

    //  判断是否展示商家用户数据
    if (modeTyep1.bizInfoList.count !=0) {
        //有商家数据
        NSString *str = [NSString stringWithFormat:@"%@%@",RootUrlImage,modeTyep1.bizInfoList[0].bizPortrait];

        [self.imageBiz sd_setImageWithURL:[NSURL URLWithString:str]];
        self.labBizName.text =modeTyep1.bizInfoList[0].bizNickName;

        self.labBizTitle.text = [NSString stringWithFormat:@"及%d个已接受报价的商家", [modeTyep1.acceptPriceCount intValue] -1];
        //有商家
        bizV = YES;
    }

    NSString *str =  [self pleaseInsertStarTimeo:modeTyep1.userEnquiryInfo.refreshTime andInsertEndTime:[self getCurrentTimes]];

    if (![modeTyep1.freshPriceCount isEqualToString:@"0"]||![modeTyep1.openSourceCount isEqualToString:@"0"]||![str isEqualToString:@"0"]) {
        Tips = YES;
        if (![modeTyep1.freshPriceCount isEqualToString:@"0"]) {
            [self.labNewReceive setTitle:[NSString stringWithFormat:@"  新收到%@个报价  ",modeTyep1.freshPriceCount] forState:UIControlStateNormal];

        }else{
            labNewGoodsSources = YES;
        }
        if (![modeTyep1.openSourceCount isEqualToString:@"0"]) {
            [self.labNewGoodsSources setTitle:[NSString stringWithFormat:@"  %@个新货源已公开  ",modeTyep1.openSourceCount] forState:UIControlStateNormal];
        }else{
            labNewReceiveType = YES;
        }

        if (![str isEqualToString:@"0"]) {
            self.labNewRefresh.enabled = YES;
            str = [NSString stringWithFormat:@"   你已经%@天没刷新询价了   ",str];
            [self.labNewRefresh setTitle:str forState:UIControlStateNormal];
        }else{
            labNewRefresh = YES;
            self.labNewRefresh.enabled = NO;
        }
    }


    self.labTakein.text = modeTyep1.acceptPriceCount;
    self.labReceive.text = modeTyep1.priceCount;
    NSString *strImage = [NSString stringWithFormat:@"%@%@",RootUrlImage,modeTyep1.imageDefault];
    [self.imageWatch sd_setImageWithURL:[NSURL URLWithString:strImage]];
    self.labTitle.text = modeTyep1.brandNameNative;
    self.labSubTitle.text = modeTyep1.goodName;

    
    if ( bizV == NO && Tips == NO) {
        NSLog(@"======= 只有手表 =======");
        index = 0 ;
    }else if (bizV == YES && Tips == NO){
        NSLog(@"======= 只有商家 =======");

        index = 1 ;
    }else if (bizV == YES && Tips == YES){
        NSLog(@"======= 有角标 有商家 =======");

        index = 2 ;
    }else if (bizV == NO && Tips == YES){
        NSLog(@"======= 有角标 没商家 =======");

        index = 3 ;
    }
    if (Tips == YES) {
        if (labNewGoodsSources) {
            [self.labNewReceive mas_updateConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(self.viewTips.mas_top).offset(0);
                make.height.mas_equalTo(0);
            }];
        }
        if ( labNewReceiveType) {
            [self.labNewGoodsSources mas_updateConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(self.labNewReceive.mas_bottom).offset(0);
                make.height.mas_equalTo(0);
            }];
        }
        if (labNewRefresh) {
            [self.labNewRefresh mas_updateConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(self.labNewGoodsSources.mas_bottom).offset(0);
                make.height.mas_equalTo(0);
            }];
            
        }
    }
    
    if (index == 0) {
        [self.viewBizinfo mas_updateConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(0);
        }];
        
        [self.viewTips mas_updateConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(0);
        }];
        [self.labEnd mas_updateConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.viewTips.mas_bottom).offset(0);
            make.height.mas_equalTo(0);
        }];
        self.labEnd.hidden = YES;
        self.viewBizinfo.hidden = YES;
        self.viewTips.hidden = YES;
    } else if (index == 1){
        [self.viewTips mas_updateConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(0);
        }];
        [self.labEnd mas_updateConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.viewTips.mas_bottom).offset(0);
            make.height.mas_equalTo(0);
        }];
        self.viewTips.hidden = YES;
        self.labEnd.hidden = YES;
    }
    
    if (index == 2){
        [self.labEnd mas_updateConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.viewTips.mas_bottom).offset(0);
            make.height.mas_equalTo(0);
        }];
        self.labEnd.hidden = YES;
    }
    if (index == 3){
        
        [self.viewBizinfo mas_updateConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(0);
        }];
        
        [self.labEnd mas_updateConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.viewTips.mas_bottom).offset(0);
            make.height.mas_equalTo(0);
        }];
        self.viewBizinfo.hidden = YES;
        self.labEnd.hidden = YES;
    }
    if (index == 4){
        [self.viewBizinfo mas_updateConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(0);
        }];
        
        [self.viewTips mas_updateConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(0);
        }];
        
        [self.view1 mas_updateConstraints:^(MASConstraintMaker *make) {
            make.width.mas_equalTo(0);
        }];
        [self.labReceive mas_updateConstraints:^(MASConstraintMaker *make) {
            make.width.mas_equalTo(0);
        }];
        [self.labSubReceive mas_updateConstraints:^(MASConstraintMaker *make) {
            make.width.mas_equalTo(0);
        }];
        
        self.view1.hidden = YES;
        self.labReceive.hidden = YES;
        self.labSubReceive.hidden = YES;
        
        self.viewBizinfo.hidden = YES;
        self.viewTips.hidden = YES;
    }
//    [self upMassonry:index];

}

//询价结束
-(void)setModeTyep2:(MyEnquiryListDataEndNewModel *)modeTyep2{
    _modeTyep2 = modeTyep2;
    self.alpha = 0.3;
    self.labTakein.text = modeTyep2.acceptPriceCount;
    NSString *strImage = [NSString stringWithFormat:@"%@%@",RootUrlImage,modeTyep2.imageDefault];
    [self.imageWatch sd_setImageWithURL:[NSURL URLWithString:strImage]];
    self.labTitle.text = modeTyep2.brandNameNative;
    self.labSubTitle.text = modeTyep2.goodName;
    
    
    [self.viewBizinfo mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(0);
    }];
    [self.viewTips mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(0);
    }];
    self.viewBizinfo.hidden = YES;
    self.viewTips.hidden = YES;
        
    [self.view1 mas_updateConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(0);
    }];
    [self.labReceive mas_updateConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(0);
    }];
    [self.labSubReceive mas_updateConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(0);
    }];
    [self.view2 mas_updateConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.labSubTitleTakein.mas_right).offset(5);
    }];
    self.view1.hidden = YES;
    self.labReceive.hidden = YES;
    self.labSubReceive.hidden = YES;
}



- (NSString *)pleaseInsertStarTimeo:(NSString *)time1 andInsertEndTime:(NSString *)time2{
    // 1.将时间转换为date
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
    NSDate *date1 = [formatter dateFromString:time1];
    NSDate *date2 = [formatter dateFromString:time2];
    // 2.创建日历
    NSCalendar *calendar = [NSCalendar currentCalendar];
    NSCalendarUnit type = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
    // 3.利用日历对象比较两个时间的差值
    NSDateComponents *cmps = [calendar components:type fromDate:date1 toDate:date2 options:0];
    // 4.输出结果
    
    NSLog(@"%@",[NSString stringWithFormat:@"%ld",cmps.day]);
    return [NSString stringWithFormat:@"%ld",cmps.day];
}
-(NSString*)getCurrentTimes{
    
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    
    // ----------设置你想要的格式,hh与HH的区别:分别表示12小时制,24小时制
    
    [formatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"];
    
    //现在时间,你可以输出来看下是什么格式
    
    NSDate *datenow = [NSDate date];
    
    //----------将nsdate按formatter格式转成nsstring
    
    NSString *currentTimeString = [formatter stringFromDate:datenow];
    
    NSLog(@"currentTimeString =  %@",currentTimeString);
    
    return currentTimeString;
    
}

-(void)setUI{
    [self addSubview: self.BackView];//边框线
    
    [self addSubview: self.viewBizinfo];//商家信息
    [self.viewBizinfo addSubview: self.imageBiz];//商家头像
    [self.viewBizinfo addSubview: self.labBizName];//商家名字
    [self.viewBizinfo addSubview: self.labBizTitle];//商家介绍
    
    [self addSubview: self.viewReceive];//报价信息
    [self.viewReceive addSubview: self.labTakein];//接受名字
    [self.viewReceive addSubview: self.labReceive];//收到报价
    [self.viewReceive addSubview: self.imageWatch];//手表头像
    [self.viewReceive addSubview: self.labTitle];//主标题
    [self.viewReceive addSubview: self.labSubTitle];//子标题
    [self.viewReceive addSubview: self.labSubTitleTakein];//接受报价
    [self.viewReceive addSubview: self.labSubReceive];//收到报价
    [self.viewReceive addSubview: self.view1];//两条竖线
    [self.viewReceive addSubview: self.view2];//两条竖线

    [self addSubview: self.viewTips];// 提醒信息
    [self.viewTips addSubview: self.labNewReceive];//新收到的报价
    [self.viewTips addSubview: self.labNewGoodsSources];//新收到的货源
    [self.viewTips addSubview: self.labNewRefresh];//刷新询价
    
    [self addSubview: self.labEnd];//询价结束
}

-(void)setMasonry{
    
    [self.viewBizinfo mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(24);
        make.left.equalTo(self).offset(18);
        make.right.equalTo(self).offset(-18);
        make.height.mas_equalTo(60);
        make.bottom.equalTo(self).offset(-24).priority(10);
    }];
    
    [self.imageBiz mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.viewBizinfo).offset(10);
        make.left.equalTo(self.viewBizinfo).offset(10);
        make.height.width.mas_equalTo(40);
    }];
    
    [self.labBizName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.imageBiz.mas_top).offset(0);
        make.left.equalTo(self.imageBiz.mas_right).offset(10);

    }];
    
    [self.labBizTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.imageBiz.mas_bottom).offset(0);
        make.left.equalTo(self.imageBiz.mas_right).offset(10);
    }];
    
    [self.viewReceive mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.viewBizinfo.mas_bottom).offset(0);
        make.left.equalTo(self).offset(18);
        make.right.equalTo(self).offset(-18);
        make.height.mas_equalTo(60);
        make.bottom.equalTo(self).offset(-24).priority(11);
    }];
    
    
    [self.labTakein mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.viewReceive).offset(5);
        make.left.equalTo(self.viewReceive).offset(5);
    }];
    
    [self.labSubTitleTakein mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.labTakein.mas_bottom).offset(5);
        make.left.equalTo(self.viewReceive).offset(5);
        make.width.mas_equalTo(80);
    }];
    
    [self.view1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.viewReceive).offset(5);
        make.bottom.equalTo(self.viewReceive).offset(-5);
        make.left.equalTo(self.labSubTitleTakein.mas_right).offset(5);
        make.width.mas_equalTo(2);
    }];
    
    [self.labReceive mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.viewReceive).offset(5);
        make.left.equalTo(self.view1).offset(5);
    }];
    
    [self.labSubReceive mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.labReceive.mas_bottom).offset(5);
        make.left.equalTo(self.view1).offset(5);
        make.width.mas_equalTo(80);
    }];
    
    [self.view2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.viewReceive).offset(5);
        make.bottom.equalTo(self.viewReceive).offset(-5);
        make.left.equalTo(self.labSubReceive.mas_right).offset(5);
        make.width.mas_equalTo(2);
    }];
    
    [self.imageWatch mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.viewReceive).offset(10);
        make.left.equalTo(self.view2).offset(10);
        make.width.height.mas_equalTo(40);
    }];
    
    [self.labTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.imageWatch.mas_top).offset(0);
        make.left.equalTo(self.imageWatch.mas_right).offset(10);
        make.right.equalTo(self).offset(-10);

    }];
    
    [self.labSubTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.imageWatch.mas_bottom).offset(0);
        make.left.equalTo(self.imageWatch.mas_right).offset(10);
        make.right.equalTo(self).offset(-10);
    }];
    
    [self.viewTips mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.viewReceive.mas_bottom).offset(0);
        make.left.equalTo(self).offset(18);
        make.right.equalTo(self).offset(-18);
        make.bottom.equalTo(self.labNewRefresh.mas_bottom).offset(8);
    }];
    
    [self.labNewReceive mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.viewTips.mas_top).offset(8);
        make.left.equalTo(self.viewTips.mas_left).offset(0);
        make.height.mas_equalTo(32);

    }];
    
    [self.labNewGoodsSources mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.labNewReceive.mas_bottom).offset(8);
        make.left.equalTo(self.viewTips.mas_left).offset(0);
        make.height.mas_equalTo(32);
    }];
    
    [self.labNewRefresh mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.labNewGoodsSources.mas_bottom).offset(8);
        make.left.equalTo(self.viewTips.mas_left).offset(0);
        make.height.mas_equalTo(32);
    }];
    
    [self.labEnd mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.viewTips.mas_bottom).offset(5);
        make.left.equalTo(self.viewTips.mas_left).offset(0);
        make.height.mas_equalTo(22);
        make.bottom.equalTo(self).offset(-24);
    }];
    
    [self.BackView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.equalTo(self).offset(10);
        make.bottom.right.equalTo(self).offset(-10);
    }];
    
    


    
    /**
     BackView;//边框线
     
     viewBizinfo;//商家信息
     imageBiz;//商家头像
     labBizName;//商家名字
     labBizTitle;//商家介绍
     
     viewReceive;//报价信息
     labTakein;//接受名字
     labSubTitleTakein;//子标题
     view1;//两条竖线

     labReceive;//收到介绍
     labSubReceive;//报价信息
     view2;//两条竖线

     imageWatch;//手表头像
     labTitle;//主标题
     labSubTitle;//子标题

     
     
     viewTips;// 提醒信息
     labNewReceive;//新收到的报价
     labNewGoodsSources;//新收到的货源
     labNewRefresh;//刷新询价
     
     labEnd;//询价结束
     */
}


-(void)setCellType:(NSInteger)index{
    //1.只显示手表信息 2.显示商家信息(必有) 3.显示按钮信息 4.显示结束询价 (3,4不可兼容)
    
    if (index == 0) {
        
    }
    
}


//商家名字
-(UILabel*)labBizName{
    if (!_labBizName) {
        _labBizName = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _labBizName.font = [UIFont systemFontOfSize:18];
        _labBizName.text = @"商家名称";
    }
    return _labBizName;
}

//商家头像
-(UIImageView*)imageBiz{
    if (!_imageBiz) {
        _imageBiz = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _imageBiz.backgroundColor = baseColorLight;
        _imageBiz.contentMode = 2;
        [_imageBiz setCornerRadiusWithRadius:8 isMasks:YES];

    }
    return _imageBiz;
}

//商家信息
-(UIView*)viewBizinfo{
    if (!_viewBizinfo) {
        _viewBizinfo = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
//        _viewBizinfo.backgroundColor = [UIColor randomColor];
    }
    return _viewBizinfo;
}

-(UIView*)BackView{
    if (!_BackView) {
        _BackView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        [_BackView setCornerRadiusWithRadius:15 isMasks:YES];
        [_BackView setBorderWithColor:[UIColor RGBColorWithR:224 g:224 b:224] width:1];
    }
    return _BackView;
}

-(UILabel*)labBizTitle{
    if (!_labBizTitle) {
        _labBizTitle = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _labBizTitle.font = [UIFont systemFontOfSize:12];
        _labBizTitle.text = @"商家介绍....";
    }
    return _labBizTitle;
}

-(UIView*)viewReceive{
    if (!_viewReceive) {
        _viewReceive = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
//        _viewReceive.backgroundColor = [UIColor randomColor];
    }
    return _viewReceive;
}

//接受名字
-(UILabel*)labTakein{
    if (!_labTakein) {
        _labTakein = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _labTakein.font = [UIFont systemFontOfSize:24];
        _labTakein.text = @"1";
    }
    return _labTakein;
}

//收到名称
-(UILabel*)labReceive{
    if (!_labReceive) {
        _labReceive = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _labReceive.font = [UIFont systemFontOfSize:24];
        _labReceive.text = @"10";
    }
    return _labReceive;
}
//接受报价
-(UILabel*)labSubTitleTakein{
    if (!_labSubTitleTakein) {
        _labSubTitleTakein = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _labSubTitleTakein.font = [UIFont systemFontOfSize:15];
        _labSubTitleTakein.text = @"接受报价";
    }
    return _labSubTitleTakein;
}

//收到报价
-(UILabel*)labSubReceive{
    if (!_labSubReceive) {
        _labSubReceive = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _labSubReceive.font = [UIFont systemFontOfSize:15];
        _labSubReceive.text = @"收到报价";
    }
    return _labSubReceive;
}
        
-(UIView*)view1{
    if (!_view1) {
        _view1 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _view1.backgroundColor = baseColorLight;
    }
    return _view1;
}

-(UIView*)view2{
    if (!_view2) {
        _view2 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _view2.backgroundColor = baseColorLight;
    }
    return _view2;
}



-(UIImageView*)imageWatch{
    if (!_imageWatch) {
        _imageWatch = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        [_imageWatch setCornerRadiusWithRadius:8 isMasks:YES];
        _imageWatch.contentMode = 1;
    }
    return _imageWatch;
}

-(UILabel*)labTitle{
    if (!_labTitle) {
        _labTitle = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _labTitle.font = [UIFont systemFontOfSize:18];
        _labTitle.text = @"手表名称";
        [_labTitle setCornerRadiusWithRadius:8 isMasks:YES];

    }
    return _labTitle;
}

-(UILabel*)labSubTitle{
    if (!_labSubTitle) {
        _labSubTitle = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _labSubTitle.font = [UIFont systemFontOfSize:12];
        _labSubTitle.text = @"手表介绍";
    }
    return _labSubTitle;
}

-(UIView*)viewTips{
    if (!_viewTips) {
        _viewTips = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
//        _viewTips.backgroundColor = [UIColor randomColor];
    }
    return _viewTips;
}


-(QMUIButton*)labNewReceive{
    if (!_labNewReceive) {
        _labNewReceive = [[QMUIButton alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _labNewReceive.titleLabel.font = [UIFont systemFontOfSize:18];
        [_labNewReceive setTitle:@"  新收到0个报价  " forState:UIControlStateNormal];
        [_labNewReceive setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_labNewReceive setCornerRadiusWithRadius:8 isMasks:YES];
        [_labNewReceive setGradientBackgroundWithColors:[UIColor defaultGradientBackgroundColors] locations:nil startPoint:CGPointZero endPoint:CGPointMake(0, 1)];
        _labNewReceive.titleLabel.font = [UIFont systemFontOfSize:10];
        @weakify(self);
        [[_labNewReceive rac_signalForControlEvents:(UIControlEventTouchUpInside)] subscribeNext:^(__kindof UIControl * _Nullable x) {
            @strongify(self);
            SKUDetailReceiveVC *vc = [[SKUDetailReceiveVC alloc]init];
            vc.indexType = @"1";
            vc.str = @"提醒商家报价";
            vc.refreshType = 1;
            vc.leb.text = @"新收到的报价";
            vc.goodsidNew = self.modeTyep1.userEnquiryInfo.goodsId;
            [self.getNav pushViewController:vc animated:YES];
            
       
            
            
        }];
    }
    return _labNewReceive;
}
/**
 SKUDetailReceiveVC *vc = [[SKUDetailReceiveVC alloc]init];
 vc.indexType = @"1";
 vc.str = @"提醒商家报价";
 vc.leb.text = @"新收到的报价";
 vc.goodsidNew = self.modelType2.userEnquiryInfo.goodsId;
 [self.getNav pushViewController:vc animated:YES];
 
 }
 - (IBAction)PublicityLab:(id)sender {
 
 SKUDetailReceiveVC *vc = [[SKUDetailReceiveVC alloc]init];
 vc.userEnquiryId = self.modelType2.userEnquiryInfo.userEnquiryId;
 vc.goodsid = self.modelType2.userEnquiryInfo.goodsId;
 vc.str = @"公开新的货源";
 [self.getNav pushViewController:vc animated:YES];*/


-(QMUIButton*)labNewGoodsSources{
    if (!_labNewGoodsSources) {
        _labNewGoodsSources = [[QMUIButton alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _labNewGoodsSources.titleLabel.font = [UIFont systemFontOfSize:18];
        [_labNewGoodsSources setTitle: @"  新收到0个公开货源  "forState:UIControlStateNormal];
        [_labNewGoodsSources setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _labNewGoodsSources.backgroundColor = [UIColor blackColor];
        [_labNewGoodsSources setCornerRadiusWithRadius:8 isMasks:YES];
        _labNewGoodsSources.titleLabel.font = [UIFont systemFontOfSize:10];

        @weakify(self);
        [[_labNewGoodsSources rac_signalForControlEvents:(UIControlEventTouchUpInside)] subscribeNext:^(__kindof UIControl * _Nullable x) {
            @strongify(self);
            SKUDetailReceiveVC *vc = [[SKUDetailReceiveVC alloc]init];
            vc.userEnquiryId = self.modeTyep1.userEnquiryInfo.userEnquiryId;
            vc.goodsid = self.modeTyep1.userEnquiryInfo.goodsId;
            vc.lookTime = self.modeTyep1.userEnquiryInfo.lookTime;
            vc.refreshType = 2;
            vc.indexType = @"2";
            vc.str = @"公开新的货源";
            [self.getNav pushViewController:vc animated:YES];
        }];
    }
    return _labNewGoodsSources;
}

-(QMUIButton*)labNewRefresh{
    if (!_labNewRefresh) {
        _labNewRefresh = [[QMUIButton alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _labNewRefresh.titleLabel.font = [UIFont systemFontOfSize:18];
        [_labNewRefresh setTitle: @"  你已经0天没刷新了  " forState:UIControlStateNormal];
        [_labNewRefresh setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _labNewRefresh.backgroundColor = [UIColor blackColor];
        [_labNewRefresh setCornerRadiusWithRadius:8 isMasks:YES];
        _labNewRefresh.titleLabel.font = [UIFont systemFontOfSize:10];
        @weakify(self);
        [[_labNewRefresh rac_signalForControlEvents:(UIControlEventTouchUpInside)] subscribeNext:^(__kindof UIControl * _Nullable x) {
            @strongify(self);
            [[serviceDefualt loadrefreshEnquiry:self.modeTyep1.userEnquiryInfo.goodsId reponseObjctClass:nil]subscribeNext:^(ResponseData * x) {
                if (x.success) {
                    if (self.blockChangeRefresh) {
                        self.blockChangeRefresh(self.index);
                    }
                    [Tools showTips:@"刷新成功"];
                }else{
                     [Tools showTips:x.errorInfo];
                }
            }];
        }];
    }
    return _labNewRefresh;
}

-(UILabel*)labEnd{
    if (!_labEnd) {
        _labEnd = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _labEnd.font = [UIFont systemFontOfSize:15];
        _labEnd.text = @" 询价已结束 ";
        _labEnd.textColor = baseColorLight;
        [_labEnd setCornerRadiusWithRadius:8 isMasks:YES];
    }
    return _labEnd;
}

@end
